﻿/*
 * RegExpress
 * 
 * Copyright (c) 2010, Daniel McGaughran
 * 
 * Licensed under the Apache Licence, Version 2.0 (the "Licence");
 * you may not use this file except in compliance with the Licence.
 * You may obtain a copy of the License at
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the Licence is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the Licence for the specific language governing permissions and
 * limitations under the Licence.
 * 
 */

using System;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows;


namespace XrControls
{
	public class Oval : Border
	{
		/// <summary>
		/// Renders the oval.
		/// </summary>
		/// <param name="dc"></param>
		/// <remarks>The thickness of the oval border is assumed to be uniform, therefore will be dependent
		/// on the 'Top' component of the Thickness.</remarks>
		protected override void OnRender(DrawingContext dc)
		{
			//base.OnRender(dc);
			Rect rect = new Rect(0, 0, RenderSize.Width, RenderSize.Height);
			double radius = Math.Min(rect.Width, rect.Height) / 2;

			dc.DrawRoundedRectangle(Background, new Pen(BorderBrush, BorderThickness.Top), rect, radius, radius );
		}


	}
}
